﻿using System;
using System.Collections.Generic;
using System.Linq;
using MyFloridaHouse.libSTO;
using MyFloridaHouse.DataAccess;
using MyFloridaHouse.libSvDTO;

namespace MyFloridaHouse.libServiceBusinessRules
{
	/// <summary>
	/// Data Dictionary methods
	/// </summary>
    public static class DataDictionary
    {
		//Todo: Remove unused code.
		#region Unused Code

		/// <summary>
		/// [Obsolete] Gets the layer data dictionary.
		/// </summary>
		/// <returns>Object: <see cref="DataDictionarySTO"/></returns>
        public static DataDictionarySTO GetLayerDataDictionary()
        {
            DataDictionarySTO results = new DataDictionarySTO();
            try
            {
                results.dictionary = new List<DataDictionaryDTO>();
                DAL_CensusData dal = new DAL_CensusData();
                var queryResultsForLayers = dal.GetLayers();
                foreach (var y in queryResultsForLayers)
                {
                    var queryResults = dal.GetLayerDataDictionary();
                    var x = from q in queryResults
                            select q;
                    results.dictionary = x.ToList();
                }

                return results;
            }
            catch (Exception ex)
            {
                results.errorMessage = ex.Message;
                return results;
            }
        }

		/// <summary>
		/// [Obsolete] Gets the data dictionary denominators.
		/// </summary>
		/// <param name="iDataPartIDList">The i data part ID list.</param>
		/// <returns></returns>
		public static DataDictionaryDenominatorSTO GetDataDictionaryDenominators(string iDataPartIDList)
        {
            DataDictionaryDenominatorSTO results = new DataDictionaryDenominatorSTO();
            try
            {
                DAL_CensusData dal = new DAL_CensusData();
                results.denominator = dal.GetDataDictionaryDenominators(iDataPartIDList);
                return results;
            }
            catch (Exception ex)
            {
                results.errorMessage = ex.Message;
                return results;
            }
        }

		/// <summary>
		/// [Obsolete] Gets the data dictionary parts.
		/// </summary>
		/// <returns></returns>
        public static DataDictionaryPartSTO GetDataDictionaryParts()
        {
            DataDictionaryPartSTO results = new DataDictionaryPartSTO();
            try
            {
                DAL_CensusData dal = new DAL_CensusData();
                results.dictionaryPart = dal.GetDataDictionaryParts();
                return results;
            }
            catch (Exception ex)
            {
                results.errorMessage = ex.Message;
                return results;
            }
		}

		#endregion

	}
}
